<script lang="ts" setup>
import { get, post, Message, loadFile } from '@/utils'
const emit = defineEmits(['update:val', 'update:data'])
const props = defineProps<{ val: string }>()
const id = ref(props.val)
const list = ref<any[]>([])
const getList = () => {
  get({ url: '/server-shop/sys-seller/seller/list' }, ({ data }) => {
    list.value = data
  })
}
getList()
const onChange = () => {
  emit('update:val', id.value)
  emit('update:data', list.value.filter(f => f.id == id.value)[0])
}
</script>
<template>
  <div style="flex: 2">
    <a-select
      :options="list"
      v-model="id"
      style="width: 100%"
      allow-search
      @change="onChange"
      :field-names="{
        label: 'name',
        value: 'id',
      }"
      placeholder="请选择"
    />
  </div>
</template>
<style lang="less" scoped></style>
